app.controller("registerController",function($scope,userService){
	$scope.registerSubmit=function(){
		var datas = $scope.user;
		console.log(datas);
		
		userService.register(JSON.stringify($scope.user)).then(function success(response){
			console.log(response); 
			if(response.data.status==="success"){
				alert("注册成功");
				location.href="./2login.html";
			}else{
				alert(response.data.data.errMsg);
			}
		})
	}
	$scope.checkUsername=function(){
		userService.checkUserName($scope.user.username).success(function(response){
			console.log(response);
			$scope.errMessage=response.data.data.errMsg;
		});
	}
	
});